package com.ipark.basic.application.config;

/**
 * Created by ozc on 2018/3/26.
 *
 * @author ozc
 * @version 1.0
 */

import com.alibaba.druid.support.http.StatViewServlet;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * druid 配置.
 * <p>
 * 这样的方式不需要添加注解：@ServletComponentScan
 *
 * @author Administrator
 */
@Configuration
public class DruidConfiguration {

    @Bean  
    public ServletRegistrationBean druidStatViewServletBean() {  
        // 后台的路径  
        ServletRegistrationBean statViewServletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),
        		"/druid/*");  
        Map<String, String> params = new HashMap<>();  
        // 账号密码，是否允许重置数据
        params.put("loginUsername", "admin");  
        params.put("loginPassword", "admin");  
        params.put("resetEnable", "true");  
        statViewServletRegistrationBean.setInitParameters(params);  
        return statViewServletRegistrationBean;  
    } 



}